// ListenSocket.cpp : implementation file
//

#include "stdafx.h"
#include "client.h"
#include "ListenSocket.h"
#include "clientDlg.h"


// CListenSocket

CListenSocket::CListenSocket()
{
}

CListenSocket::~CListenSocket()
{
}


// CListenSocket member functions

void CListenSocket::OnAccept(int nErrorCode)
{
	// TODO: Add your specialized code here and/or call the base class
	CclientDlg * pdlg = (CclientDlg *) ::AfxGetMainWnd();
	//pdlg->workSocket
	if( pdlg->workSocket.m_hSocket )
	{
		pdlg->workSocket.Close();
		if ( this->Accept(pdlg->workSocket))
		{
			pdlg->SetTimer( REQUEST_TIMER,1000,NULL );
		}
	}
	CSocket::OnAccept(nErrorCode);
}

void CListenSocket::OnClose(int nErrorCode)
{
	// TODO: Add your specialized code here and/or call the base class
	TRACE( "OnClose \r\n");
	CSocket::OnClose(nErrorCode);
}
